*** Settings ***
Documentation    TC08-Round Management AIR-Submit Rate
Resource    ../../Keywords/Common_Head.robot
Resource    ../../Keywords/Common/Common_kw.robot
Force Tags    P1
Metadata    Author    Terence
Metadata    ID    13565
Test Teardown    Run Keywords    Run Keyword And Ignore Error    Delete Project    ${G_TENDERID}
...    AND    Run Keyword And Ignore Error    Delete Tender    ${G_TENDERID}
...    AND    CloseSpace
...    AND    Set Global Variable    ${USERNAME}    AUTOTEST

*** Test Cases ***
TC08-Round Management AIR-Submit Rate
    Step 1 User Goes To Basic Data Management Tender List
    Step 2 User Goes To Pricing Collaboration Pricing Project
    Step 3 Input Following Attributes
    Step 4 User Selects Row That Project Name Is 20240815 AIR
    Step 5 Select This Entry Click On Copy Data Button And Yes In
    Step 6 Select Current Project In Pricing Project Click On
    Step 7 User Clicks Next Round Management Button
    Step 8 Upload Some Attachments To The Round Page
    Step 9 User Sets The Three Region s Deadline To Three
    Step 10 User Clicks Assignment Button
    Step 11 User Selects Candidates APAC WENDJIAN EUROPE WENDJIAN
    Step 12 User Clicks Save Button
    Step 13 User Clicks Start Button
    Step 14 User Clicks Yes Button
    Step 15 User Clicks Send Button
    Step 16 Reopen This Window Switch Current User Role To Regional
    Step 17 Reopen This Window Exchange Role To Country Pricing
    Step 18 Click On Submission Button In The New Dialog Select All
    Step 19 Click On Submit Button
    Step 20 Close This Pop up Window
    Step 21 Repeat Step 17 To Step20 To Submit Rate By All
    Step 22 Exchange Current Role To Project Owner
    Step 23 Select Send Notification To All Pricing Manager
    Step 24 Check Email Received
    Step 25 Click On Close Button
    Step 26 Select This Project Click On Delete Project Button
    Step 27 User Goes To Basic Data Management Tender List 27



*** Keywords ***
Step ${step} User Goes To Basic Data Management Tender List
    #************************Step 1******************************
    #  Do:
    #      User goes to Basic Data Management Tender List
    #      Click Create button
    #      Input with following attributes
    #      Tender ID some numbers such as 202408151435001 you can
    #     input with current datetime and some random number to
    #     avoid duplicate validation
    #      Tender Title some value such as Regression Test by
    #     Wendy001
    #      Customer 815 Miele
    #      Mode select all
    #      Level Global
    #      Click on Save button
    #  Expected:
    #      Created successfully with the message Tender has been
    #     added
    #************************************************************
    Login Space
    ${G_TENDERID}    Generate Tender ID
    ${TenderTitle}   Set Variable    Regression Test by Wendy001
    Set Suite Variable     ${G_TENDERID}    ${G_TENDERID}
    Set Suite Variable     ${TenderTitle}    ${TenderTitle}
    Create Tender    ${G_TENDERID}    ${TenderTitle}    815    true    true    true

Step ${step} User Goes To Pricing Collaboration Pricing Project
    #************************Step 2******************************
    #  Do:
    #      User goes to Pricing Collaboration Pricing Project
    #      User clicks Create Project button
    #  Expected:
    #      A New Project dialog should be opened successfully
    #************************************************************
    Log    Finish in next step

Step ${step} Input Following Attributes
    #************************Step 3******************************
    #  Do:
    #      Input following attributes
    #      Tender ID 20240815 Regression
    #      Mode Air
    #      Deadline to TM current date 10 day
    #      Rate Validity From current date
    #      Rate Validity To current date 100 day
    #      Deputies NATZHANG
    #      Description for regression
    #      Click on Save button
    #  Expected:
    #      A new project is created successfully
    #************************************************************
    ${DeadLine}    Get Current Date    UTC    +10days    result_format=%d/%m/%Y
    ${ValidFrom}    Get Current Date    UTC    result_format=%d/%m/%Y
    ${ValidTo}    Get Current Date    UTC    +100days    result_format=%d/%m/%Y
    ${PROJECT}    Copy Dictionary    ${PROJECT_PARAM}
    Set To Dictionary    ${PROJECT}    
    ...    TENDER_ID=${G_TENDERID}    TENDER_TITLE=${TenderTitle}    CUSTOEMR_NAME=Miele    CUSTOMER_LEVEL=Global
          ...   MODE=AIR    DEADLINE_TM_DATE=${DeadLine}    VALID_FROM=${ValidFrom}    VALID_TO=${ValidTo}    DEPUTY=NATZHANG
    Set Test Variable    ${PROJECT}    ${PROJECT}
    Create Project    ${PROJECT}

Step ${step} User Selects Row That Project Name Is 20240815 AIR
    #************************Step 4******************************
    #  Do:
    #      User selects row that project name is 20240815 AIR
    #     Regression
    #      Click on Copy Data
    #      In the pop up dialog input Tender ID with value
    #     2024000001 click on Search button
    #  Expected:
    #      index php attachments get b3256194 701d 4b1d a71b
    #     7de2f84b3f5e Result list has one entry as above
    #     information
    #************************************************************
    Search Project    ${PROJECT.TENDER_ID}

Step ${step} Select This Entry Click On Copy Data Button And Yes In
    #************************Step 5******************************
    #  Do:
    #      Select this entry click on Copy Data button and Yes in
    #     pop up window
    #  Expected:
    #      Successfully with messages in pop up window
    #      Tender has been successfully copied from 2024000001 AIR
    #     do not touch me
    #      Please adjust the template and the lanes in Template
    #     Lane Management page if required
    #      After click on OK button
    #      The same message is displayed in Pricing Project page
    #     too
    #************************************************************
    Copy Data    2024000001    AIR    do not touch me

Step ${step} Select Current Project In Pricing Project Click On
    #************************Step 6******************************
    #  Do:
    #      Select current project in pricing project click on
    #     template management button
    #      Click Skip button in Step4 and Yes in the pop up
    #     windown
    #  Expected:
    #      Next Round Management button is enable
    #************************************************************
    Click    //td[contains(text(),"${G_TENDERID}")]
    Click    ${Project_toolbar_TemplateManagementButton}
    Click    //button[.="Skip"]
    Wait For Elements State    //span[contains(text(),"Are you sure to skip push pricing?")]
    Click    ${Dialog_yesButton}
    Sleep    2
    Wait For Elements State    //button[contains(text(),"Next: Round Management")]    enabled
    
Step ${step} User Clicks Next Round Management Button
    #************************Step 7******************************
    #  Do:
    #      User clicks Next round management button
    #  Expected:
    #      A dialogue appears The current role is project owner
    #      It divides into 5 parts
    #      1 Generation Information current Pricing Round 1
    #     Started 2 lanes check the project information is right
    #     with actual condition
    #      2 Assignment
    #      3 Attached Document
    #      4 Round History
    #      5 The tasks status Region Country My tasks
    #************************************************************
    Click    //button[contains(text(),"Next: Round Management")]
    Wait For Elements State    //h4/span[contains(text(),"Project ${G_TENDERID}-AIR-${TenderTitle}")]
    Wait For Elements State    //legend[.="Generation Information"]
    Wait For Elements State    //legend[.="Assignment"]
    Wait For Elements State    //legend[.="Attached Document"]
    Wait For Elements State    //legend[.="Round History"]
    Wait For Elements State    //a[.="Region"]
    Wait For Elements State    //a[.="My Tasks"]

Step ${step} Upload Some Attachments To The Round Page
    #************************Step 8******************************
    #  Do:
    #      Upload some attachments to the round page
    #  Expected:
    #      The attachments uploaded successfully
    #************************************************************
    Wait For Elements State    ${Project_RoundMgmt_RoutConfirmButton}    enabled    30
    Click    ${Project_RoundMgmt_RoutConfirmButton}
    Click    xpath=//div//tr[td//text()[contains(.,"APAC")]]//input[@type='checkbox']
    Click    ${Project_RoundMgmt_Routing_Setup}
    Wait For Elements State    ${Project_RoundMgmt_Setup_Download}    visible    10
    ${filename}    Download File    ${Project_RoundMgmt_Setup_Download}
    Set Test Variable    ${filename}     ${filename} 
    Click    ${Project_RoundMgmt_Setup_Upload}
    Wait For Elements State    ${Project_RoundMgmt_Setup_UploadAddFile}    visible    60
    Wait For Elements State   ${Project_RoundMgmt_Setup_UploadAddFile}     enabled
    Upload File By Selector    ${upload_addFileButton}    ${filename}
    Wait Until Search Finished
    Wait For Elements State    ${Project_RoundMgmt_Setup_UploadAddFile_OKButton}    visible    60
    Click    ${Project_RoundMgmt_Setup_UploadAddFile_OKButton}
    Remove File    ${filename}
    Sleep    2
    Click    ${Dialog_Close}
Step ${step} User Sets The Three Region s Deadline To Three
    #************************Step 9******************************
    #  Do:
    #      User sets the three region s deadline to three
    #     different time
    #      APAC current date +10
    #      EUROPE current date +10
    #      NAM current +10
    #  Expected:
    #      It can set successfully
    #************************************************************
    ${DeadLine}    Get Current Date    UTC    +10days    result_format=%d/%m/%Y
    Fill Text    ${Project_RoundMgmt_Assign_APAC_Deadline}    ${DeadLine}
    # ${DeadLine}    Get Current Date    UTC        result_format=%d/%m/%Y
    Fill Text    ${Project_RoundMgmt_Assign_EUROPE_Deadline}    ${DeadLine}
    # ${DeadLine}    Get Current Date    UTC    result_format=%d/%m/%Y
    Fill Text    ${Project_RoundMgmt_Assign_NAM_Deadline}    ${DeadLine}

Step ${step} User Clicks Assignment Button
    #************************Step 9******************************
    #  Do:
    #      User clicks assignment button
    #  Expected:
    #      There are three tabs in the dialogue APAC Europe NAM
    #************************************************************
    Wait Until Keyword Succeeds    5x    100ms    Click    ${Project_RoundMgmt_AssignButton}
    Wait For Elements State    ${Project_RoundMgmt_Assign_ApacTab}
    Wait For Elements State    ${Project_RoundMgmt_Assign_EuropeTab}
    Wait For Elements State    ${Project_RoundMgmt_Assign_NamTab}

Step ${step} User Selects Candidates APAC WENDJIAN EUROPE WENDJIAN
    #************************Step 10******************************
    #  Do:
    #      User selects candidates APAC WENDJIAN EUROPE WENDJIAN
    #     NAM WENDJIAN
    #  Expected:
    #      They can be selected successfully
    #************************************************************
    Click    xpath= //div[@data-model='selectedItems']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_ApacTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_EuropeTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_NamTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']

Step ${step} User Clicks Save Button
    #************************Step 11******************************
    #  Do:
    #      User clicks save button
    #  Expected:
    #      The assignment disappears The regional tab shows the
    #     selected candidates
    #************************************************************
    Click    ${Project_RoundMgmt_Assign_SaveButton}
    Wait Until Search Finished
    Wait For Elements State    //legend[contains(text(),"APAC")]/..//span[contains(text(),"WENDJIAN")]
    Wait For Elements State    //legend[contains(text(),"EUROPE")]/..//span[contains(text(),"WENDJIAN")]
    Wait For Elements State    //legend[contains(text(),"NAM")]/..//span[contains(text(),"WENDJIAN")]

Step ${step} User Clicks Start Button
    #************************Step 13******************************
    #  Do:
    #      User clicks start button
    #  Expected:
    #      A dialogue appears It asks are you sure to start round
    #     and there is a default check box below it The check box
    #     is checked and the name is send notification to regional
    #     pricing manager
    #************************************************************
    Click    ${Project_RoundMgmt_StartButton}
    Wait For Elements State    //label[.="Are you sure to start round1?"]
    Wait For Elements State    //span[.="Send notification to regional pricing manager."]
    Wait For Elements State    //span[.="Send notification to regional pricing manager."]/../input[@checked="checked"]

Step ${step} User Clicks Yes Button
    #************************Step 14******************************
    #  Do:
    #      User clicks yes button
    #  Expected:
    #      A new notification appears
    #      index php attachments get 94ab2560 6e3c 421f 8724
    #     d3ae53156f79
    #************************************************************
    Wait Until Keyword Succeeds    10x    100ms    Click    ${Project_RoundMgmt_StartConfirmButton} 
    Wait Until Search Finished
    Wait For Elements State    //h4[.="New Notification"]

Step ${step} User Clicks Send Button
    #************************Step 15******************************
    #  Do:
    #      User clicks send button
    #  Expected:
    #      In generation information it shows current pricing
    #     Round 1 Started 2 lanes
    #      The project owner will received three letters
    #      The regional pricing leader will also receive a letter
    #      index php attachments get 4a890cfc 49fd 48eb b91c
    #     8512067bb3e4
    #************************************************************
    Wait Until Keyword Succeeds    20x    100ms    Click    ${Project_RoundMgmt_Confirm_SendButton}
    Wait Until Search Finished
    Wait For Elements State    //span[.="1 (Started) 2 lanes"]

Step ${step} Reopen This Window Switch Current User Role To Regional
    #************************Step 16******************************
    #  Do:
    #      Reopen this window Switch current user role to Regional
    #     Pricing Manager EUROPE NAM APAC
    #      In Assignment assign WENDJIAN to each Country and
    #     Cluster
    #      Set deadline as
    #      Country
    #      AU current date -1
    #      CN N current date +10
    #      DE current date
    #      US current date
    #      Cluster
    #      Australia New Zealand current date 1
    #      Germany Switzerland current date 10
    #      Greater China current date
    #      Send Notification
    #  Expected:
    #      The country pricing leader will also receive a letter
    #      index php attachments get b87684dc e4fc 4f71 a822
    #     e79c00c7a108
    #************************************************************
    Close Browser
    Set Global Variable    ${USERNAME}    WENDJIAN
    Login Space
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    500ms    Click    ${Project_toolbar_RoundMgmtButton}
    Wait For Elements State    //div[@ng-click="toggleDropdown()"]
    Click    //div[@ng-click="toggleDropdown()"]
    Click    //div[contains(text(),"Regional Pricing Manager(EUROPE,NAM,APAC)")]
    Sleep    10
    ${DeadLine}    Get Current Date    UTC    -1days    result_format=%d/%m/%Y
    # Fill Text    ${Project_RoundMgmt_Assign_Country_row1col1_Deadline}    ${DeadLine}
    Input Deadline In Country Tab    0    0    ${DeadLine}
    ${DeadLine}    Get Current Date    UTC    +10days    result_format=%d/%m/%Y
    # Fill Text    ${Project_RoundMgmt_Assign_Country_row1col2_Deadline}    ${DeadLine}
    Input Deadline In Country Tab    0    1    ${DeadLine}
    # ${DeadLine}    Get Current Date    UTC    result_format=%d/%m/%Y
    # Fill Text    ${Project_RoundMgmt_Assign_Country_row2col1_Deadline}    ${DeadLine}
    Input Deadline In Country Tab    1    0    ${DeadLine}
    Input Deadline In Country Tab    1    1    ${DeadLine}

    Click    //legend[.="Assignment"]/..//a[.="Cluster"]
    ${DeadLine}    Get Current Date    UTC    -1days    result_format=%d/%m/%Y
    # Fill Text    ${Project_RoundMgmt_Assign_Cluster_row1col1_Deadline}    ${DeadLine}
    Input Deadline In Cluster Tab    0    0    ${DeadLine}
    ${DeadLine}    Get Current Date    UTC    +10days    result_format=%d/%m/%Y
    # Fill Text    ${Project_RoundMgmt_Assign_Cluster_row1col2_Deadline}    ${DeadLine}
    Input Deadline In Cluster Tab    0    1    ${DeadLine}
    ${DeadLine}    Get Current Date    UTC    result_format=%d/%m/%Y
    # Fill Text    ${Project_RoundMgmt_Assign_Cluster_row2col1_Deadline}   ${DeadLine}
    Input Deadline In Cluster Tab    1    0    ${DeadLine}

    Wait Until Keyword Succeeds    5x    100ms    Click    ${Project_RoundMgmt_AssignButton}
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_AUTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_CNTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_DETab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_USTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Click    ${Project_RoundMgmt_Assign_ClusterTab}
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_AustraliaTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_GermanyTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Round Mgmt Assign User    ${Project_RoundMgmt_Assign_ChinaTab}    xpath=//div[@data-model='availableItems']//ul//li//b[.='Wendy Jiang (WENDJIAN)']
    Click    ${Project_RoundMgmt_Assign_SaveButton}
    Wait Until Search Finished
    
    Click    ${Project_RoundMgmt_SendNotifButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_SendButton}
    Click    ${Project_RoundMgmt_Confirm_SendButton}
    Wait Until Search Finished
    

Step ${step} Reopen This Window Exchange Role To Country Pricing
    #************************Step 17******************************
    #  Do:
    #      Reopen this window exchange role to Country Pricing
    #     Manager US
    #      clicks download button in generation information
    #  Expected:
    #      The file can be downloaded successfully
    #      Update some value of the rates
    #************************************************************
    Close Browser
    Set Global Variable    ${USERNAME}    WENDJIAN
    Login Space
    Search Project    ${PROJECT.TENDER_ID}
    Wait Until Search Finished
    Wait Until Keyword Succeeds    10x    500ms    Click    ${Project_toolbar_RoundMgmtButton}

    Wait For Elements State    //div[@ng-click="toggleDropdown()"]
    Click    //div[@ng-click="toggleDropdown()"]
    Click    //div[contains(text(),"Country Pricing Manager(US)")]
    Wait Until Search Finished
    
    ${filename}    Download File    ${Project_RoundMgmt_DownloadButton}
    Set Test Variable    ${filename}    ${filename}
    Wait Until Search Finished

    Open Excel Document     ${filename}    Sheet0
    Write Excel Cell    5    82    ${90.00}
    Save Excel Document    ${filename}
    Close Current Excel Document


Step ${step} Click On Submission Button In The New Dialog Select All
    #************************Step 18******************************
    #  Do:
    #      Click on Submission button in the new dialog Select All
    #     Upload the updated file
    #  Expected:
    #      In Step2 Summary SUCCESSFUL
    #      Your selected lanes have been uploaded
    #      In Step3 Submit button is displayed
    #************************************************************
    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait For Elements State    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${filename}
    Wait Until Search Finished
    Wait For Elements State    //span[contains(text(),"SUCCESSFUL")]
    Wait For Elements State    //button[.="Submit"]    enabled

Step ${step} Click On Submit Button
    #************************Step 19******************************
    #  Do:
    #      Click on Submit button
    #  Expected:
    #      It displays
    #      Summary SUCCESSFUL
    #      Your rates have been submitted
    #      under Step 3
    #************************************************************
    Click    //button[.="Submit"]
    Wait For Elements State    //legend[.="Step 3: Submit Charges"]/..//span[contains(text(),"SUCCESSFUL")]
    Get Text    //legend[.="Step 3: Submit Charges"]/..//div    contains    Your rates have been submitted

Step ${step} Close This Pop up Window
    #************************Step 20******************************
    #  Do:
    #      Close this pop up window
    #      Check the role part
    #      Check the task Country Cluster tab
    #      Download IPT to check
    #      Check the email receieved
    #  Expected:
    #      Background color is green index php attachments get
    #     7f1479aa 3455 4420 8c31 d576acda3d85
    #      index php attachments get db2ce3fc 03ea 4bec abe8
    #     841cfeabeb6f
    #      The rates should be the same as updated file
    #      index php attachments get df6cef47 3672 4f85 9a4d
    #     f0410a5c2d5e
    #************************************************************
    Click    ${Dialog_Close}
    # Get Element States    //div[@ng-click="toggleDropdown()"]//span
    Get Style    //div[@ng-click="toggleDropdown()"]//span    background    contains    rgb(0, 128, 0)
    Get Style    //td[.="US"]/..//span[.="1/1"]/..    background    contains    rgb(60, 165, 50)

Step ${step} Repeat Step 17 To Step20 To Submit Rate By All
    #************************Step 21******************************
    #  Do:
    #      Repeat step 17 to Step20 to submit rate by all
    #     countries clusters regions
    #  Expected:
    #      As step 17 to Step20
    #************************************************************
    Repeat 17-20    AU
    Repeat 17-20    CN-N
    Repeat 17-20    DE
    Repeat 17-20    AU-NZ    False
    Repeat 17-20    DE-CH    False
    Repeat 17-20    GREATER CHINA    False

Step ${step} Exchange Current Role To Project Owner
    #************************Step 22******************************
    #  Do:
    #      Exchange current role to Project Owner
    #      Click on Close Round button
    #  Expected:
    #      An pop up window Close Round1_ProjectName
    #      Are you sure you want to close the pricing round
    #      3 options
    #      Send notification to regional pricing manager
    #      Send notification to all pricing manager
    #      Do not send notification to anyone
    #************************************************************
    Wait For Elements State    //div[@ng-click="toggleDropdown()"]
    Click    //div[@ng-click="toggleDropdown()"]
    Click    //div[contains(text(),"Project Owner")]
    Wait Until Search Finished
    Click    ${Project_RoundMgmt_CloseRoundButton}
    Wait For Elements State    //span[.="Send notification to regional pricing manager."]
    Wait For Elements State    //span[.="Send notification to all pricing manager."]
    Wait For Elements State    //span[.="Do not send notification to anyone."]

Step ${step} Select Send Notification To All Pricing Manager
    #************************Step 23******************************
    #  Do:
    #      Select Send notification to all pricing manager
    #      User clicks yes button
    #  Expected:
    #      1 A prompt says Close Success
    #      2 Current Pricing Round 1 Closed 2 lanes
    #      3 There have new round button and reopen round button
    #************************************************************
    Click    //span[.="Send notification to all pricing manager."]
    Click    //button[contains(text(),"Yes")]
    Wait For Elements State    //span[.="Close Success"]
    Wait For Elements State    //span[.="1 (Closed) 2 lanes"]
    Wait For Elements State    //button[contains(text(),"New Round")]
    Wait For Elements State    //button[contains(text(),"Reopen Round")]

Step ${step} Check Email Received
    #************************Step 24******************************
    #  Do:
    #      Check email received
    #  Expected:
    #      index php attachments get de7fc98c 227e 45d2 b7ef
    #     469a7df5315a
    #************************************************************
    Log    cannot check email

Step ${step} Click On Close Button
    #************************Step 25******************************
    #  Do:
    #      Click on Close button
    #      In Pricing Project page User selects TenderID Contains
    #     20240815
    #  Expected:
    #      The project could be found
    #************************************************************
    Click    ${Project_RoundMgmt_CloseButton}
    Log    finish in teardown

Step ${step} Select This Project Click On Delete Project Button
    #************************Step 26******************************
    #  Do:
    #      Select this project click on Delete Project button
    #      Click Yes of the pop up confirm window
    #      If Delete Project button is disable do Data Cleaning
    #     and cancel first and then Delete Project button is
    #     enable
    #  Expected:
    #      System displays Project has been deleted
    #************************************************************
    Log    finish in teardown

Step ${step} User Goes To Basic Data Management Tender List 27
    #************************Step 27******************************
    #  Do:
    #      User goes to Basic Data Management Tender List
    #      Search out the tender created in step1
    #      Click on Delete button
    #      Click on Yes button in the popup dialog
    #  Expected:
    #      System displays Tender has been deleted
    #************************************************************
    Log    finish in teardown


Repeat 17-20
    [Arguments]    ${Counrty_Cluster_Code}    ${isCountry}=True    ${columnIndex}=115
    #For DE
    Wait For Elements State    //div[@ng-click="toggleDropdown()"]
    Click    //div[@ng-click="toggleDropdown()"]
    IF    '${isCountry}' == 'True'
        Click    //div[contains(text(),"Country Pricing Manager(${Counrty_Cluster_Code})")]
    ELSE
        Click    //div[contains(text(),"Cluster Head(${Counrty_Cluster_Code})")]
    END

    Wait Until Search Finished
    
    ${filename}    Download File    ${Project_RoundMgmt_DownloadButton}
    Set Test Variable    ${filename}    ${filename}
    Wait Until Search Finished

    Open Excel Document     ${filename}    Sheet0
    Write Excel Cell    5    ${columnIndex}    110.00
    Save Excel Document    ${filename}
    Close Current Excel Document

    Click    ${Project_RoundMgmt_SubmissionButton}
    Wait For Elements State    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_SelectAll}
    Click    ${Project_RoundMgmt_Submit_UploadButton}
    Wait For Elements State    ${Project_RoundMgmt_Confirm_UploadAddFile}    visible    10
    Upload File By Selector    ${upload_addFileButton}    ${filename}
    Wait Until Search Finished
    Wait For Elements State    //span[contains(text(),"SUCCESSFUL")]
    Wait For Elements State    //button[.="Submit"]    enabled

    Click    //button[.="Submit"]
    Wait For Elements State    //legend[.="Step 3: Submit Charges"]/..//span[contains(text(),"SUCCESSFUL")]
    Get Text    //legend[.="Step 3: Submit Charges"]/..//div    contains    Your rates have been submitted
    Click    ${Dialog_Close}
    Wait Until Search Finished
    Sleep    5
    # Get Element States    //div[@ng-click="toggleDropdown()"]//span
    Get Style    //div[@ng-click="toggleDropdown()"]//span    background    contains    rgb(0, 128, 0)
    IF    '${isCountry}' == 'False'
        Click    //a[.="Cluster"]
        IF    '${Counrty_Cluster_Code}' == 'AU-NZ'
            ${Cluster}    Set Variable    Australia & New Zealand
        END
        IF    '${Counrty_Cluster_Code}' == 'DE-CH'
            ${Cluster}    Set Variable    Germany & Switzerland
        END
        IF    '${Counrty_Cluster_Code}' == 'GREATER CHINA'
            ${Cluster}    Set Variable    Greater China
        END
        Get Style    //td[.="${Cluster}"]/..//span[.="1/1"]/..    background    contains    rgb(60, 165, 50)
    ELSE
        Get Style    //td[.="${Counrty_Cluster_Code}"]/..//span[.="1/1"]/..    background    contains    rgb(60, 165, 50)
    END
